package com.woniu.dao;

import com.woniu.pojo.Mess;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MessMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Mess record);

    int insertSelective(Mess record);

    Mess selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Mess record);

    int updateByPrimaryKey(Mess record);

    @Select("select * from mess where accept_id = #{id} order by create_time desc")
    List<Mess> getRecByUserId(Long id);
    @Select("select * from mess where user_id = #{id} order by create_time desc")
    List<Mess> getSendByUserID(Long id);

    @Delete("delete from mess where accept_id =#{id} ")
    int delRec(Long id);

    @Delete("delete from mess where user_id =#{id}")
    int delSend(Long id);

    @Select("select * from mess where (accept_id=#{id} or user_id=#{id} ) and content like CONCAT(CONCAT('%',#{mes}),'%')")
    List<Mess> getBySearch(Long id, String mes);
} 